Type Error Customization in GHC (DRAFT)

نویسندگان

  • Alejandro Serrano
  • Jurriaan Hage
چکیده

Abstract Embedded domain speci€c languages (DSLs) are a common paŠern in the functional programming world, providing very high-level abstractions to programmer. Unfortunately, this abstraction is broken when type errors occur, leaking details of the DSL implementation. In this paper we present a set of techniques for customizing type error diagnosis in order to avoid this leaking. Œese techniques have been implemented in the GHC Haskell compiler. Our customizations are declared in the type signatures of functions provided by the DSL, leading to type error message that are context-dependent: the same kind of error can be reported in a di‚erent way depending on the particular expression in which it occurs. We make use of the ability to manipulate constraints using type-level programming which is already present in GHC, and which enables reuse and abstraction of common type error paŠerns.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Injective Type Families for Haskell (extended version)

Haskell, as implemented by the Glasgow Haskell Compiler (GHC), allows expressive type-level programming. The most popular typelevel programming extension is TypeFamilies , which allows users to write functions on types. Yet, using type functions can cripple type inference in certain situations. In particular, lack of injectivity in type functions means that GHC can never infer an instantiation ...

متن کامل

Injective Type Families for Haskell ( extended version ) 1

Haskell, as implemented by the Glasgow Haskell Compiler (GHC), allows expressive type-level programming. The most popular typelevel programming extension is TypeFamilies , which allows users to write functions on types. Yet, using type functions can cripple type inference in certain situations. In particular, lack of injectivity in type functions means that GHC can never infer an instantiation ...

متن کامل

An overabundance of equality: Implementing kind equalities into Haskell

Haskell, as embodied by version 7.10.1 of the Glasgow Haskell Compiler (GHC), supports reasoning about equality among types, via generalized algebraic datatypes (GADTs) and type families. However, these features are not available among the kinds that classify the types. Motivated by a concrete example of how kind equalities can help programmers today, this paper presents the challenges and solu...

متن کامل

An overabundance of equality : Implementing kind equalities into Haskell ( Extended version )

Haskell, as embodied by version 7.10.1 of the Glasgow Haskell Compiler (GHC), supports reasoning about equality among types, via generalized algebraic datatypes (GADTs) and type families. However, these features are not available among the kinds that classify the types. Motivated by a concrete example of how kind equalities can help programmers today, this paper presents the challenges and solu...

متن کامل

Thesis Proposal (Draft)

The goal of my thesis project is to create a framework for encoding and reasoning about functional languages in the Isabelle theorem prover. The framework will encode languages using deep embeddings, with higher-order abstract syntax. The motivating test case is the GHCCore language—an explicitly-typed, desugared variant of Haskell which is used as an intermediate language by the Glasgow Haskel...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2017